import { reqUserAddress, reqTradeInfo } from "@/api"

export default {
    state: {
        userAddress: [],
        tradeInfo:{}
    },
    mutations: {
        UPDATE_USERADDRESS(state, userAddress) {
            state.userAddress = userAddress
        },
        UPDATE_TRADEINFO(state, tradeInfo) {
            state.tradeInfo = tradeInfo
        }
    },
    actions: {
        async getUserAddress({ commit }) {
            const res = await reqUserAddress()
            if (res.code === 200) {
                commit('UPDATE_USERADDRESS',res.data)
            }
        },
        async getTradeInfo({commit}) {
            const res = await reqTradeInfo()
            if (res.code === 200) {
                console.log(res.data);
                commit('UPDATE_TRADEINFO',res.data)
            }
        }
    },
    getters:{}
}